package com.example.demo.service;

import com.example.demo.dao.ClassroomtypeDao;
import com.example.demo.entity.ClassroomTypeEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClassroomtypeService {

   @Autowired
   private ClassroomtypeDao classroomtypeDao;


    /**
     * 通过ID查询单条数据
     */
    public ClassroomTypeEntity queryClassroomtypeById(Integer ctid){
        return classroomtypeDao.queryClassroomtypeById(ctid);
    }

    /**
     * 通过实体作为筛选条件查询
     */
    public List<ClassroomTypeEntity> queryClassroomtypeAll(){
        return classroomtypeDao.queryClassroomtypeAll();
    }

    /**
     * 新增数据
     */
    public int insertClassroomtype(ClassroomTypeEntity classroomtype){
       return classroomtypeDao.insertClassroomtype(classroomtype);
    }

    /**
     * 修改数据
     */
    public int updateClassroomtype(ClassroomTypeEntity classroomtype){
       return classroomtypeDao.updateClassroomtype(classroomtype);
    }

    /**
     * 通过主键删除数据
     */
    public int deleteByIdClassroomtype(Integer ctid){
       return classroomtypeDao.deleteByIdClassroomtype(ctid);
    }

    //根据选择的楼栋id查询有此楼下有多少教室类型
    public List<ClassroomTypeEntity> selectClassTypeByBuilding(Integer bid){
        return classroomtypeDao.selectClassTypeByBuilding(bid);
    }
}